//
//  UIDevice+MGAdd.h
//  MGKit
//
//  Created by yideqiang on 2018/6/13.
//

#import <UIKit/UIKit.h>
#import <YYKit/YYKit.h>

#pragma mark - 系统版本号相关

#define IS_IPAD             (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE           (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
//获取系统版本
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

#define IOS8 ([[UIDevice currentDevice].systemVersion doubleValue] >= 8.0 && [[UIDevice currentDevice].systemVersion doubleValue] < 9.0)
#define IOS8_10 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 && [[UIDevice currentDevice].systemVersion doubleValue] < 10.0)
#define IOS10 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0)
#define IOS11 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0)

#pragma mark - 屏幕宽高

#ifndef kMGScreenWidth
#define kMGScreenWidth [UIScreen mainScreen].bounds.size.width
#endif

#ifndef kMGScreenHeight
#define kMGScreenHeight [UIScreen mainScreen].bounds.size.height
#endif

#define IS_SCREEN_55_INCH    ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(1125, 2001), [[UIScreen mainScreen] currentMode].size)) : NO)
#define IS_SCREEN_47_INCH    ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define IS_SCREEN_4_INCH     ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define IS_SCREEN_35_INCH    ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960),  [[UIScreen mainScreen] currentMode].size) : NO)

//自动换算比例（高度）
#define AutoNum(num) (num * kMGScreenWidth / 375.0)

#define iPhoneX (kScreenWidth >= (375.0) && kScreenHeight >= (812.0))
#define iPhoneXYOffset (iPhoneX ? 24 : 0)
#define iPhoneXBottomOffset (iPhoneX ? 34 : 0)
#define iPhoneXNavHeight (iPhoneX ? 88 : 64)
#define iPhoneXTabbarHeight (iPhoneX ? 83 : 49)

@interface UIDevice (MGAdd)

+ (NSString *)OSVersion;
+ (NSString *)appVersion;
+ (NSString *)appShortVersion;
+ (NSString *)appIdentifier;
+ (NSString *)appSchema;
+ (NSString *)appSchema:(NSString *)name;
+ (BOOL)isPad;

@end
